home *** CD-ROM | disk | FTP | other *** search
- #include <graphics.h>
- /* Define the fill style masks */
- unsigned char fillpattern[4][8] =
- {
- /* First mask */
- 1, 3, 7, 0xf, 0x1f, 0x3f, 0x7f, 0xff,
- /* Mask 2 */
- 0xf0, 0xf0, 0xf0, 0xf0, 0xf, 0xf, 0xf, 0xf,
- /* Mask 3 */
- 0xcc, 0x33, 0xcc, 0x33, 0xcc, 0x33, 0xcc, 0x33,
- /* Mask 4 */
- 0xc3, 0xc3, 0xc, 0xc, 0x30, 0x30, 0xc3, 0xc3
- };
- main()
- {
- int graphdriver = DETECT;
- int graphmode;
- int i, x1=0, y1=40;
- /* Detect and initialize graphics system */
- initgraph(&graphdriver, &graphmode, "c:\\turboc");
- outtextxy(10,10, "Illstrating different fill styles:");
- /* Draw filled rectangle with different fill styles */
- for (i=1; i<=2; i++)
- {
- setfillpattern(fillpattern[2*i-2], RED);
- bar(x1, y1, x1+100, y1+60);
- setfillpattern(fillpattern[2*i-1], YELLOW);
- bar(x1+150, y1, x1+250, y1+60);
- y1 += 100;
- }
- /* Give user a chance to see the result */
- outtextxy(getmaxx()/2, getmaxy() - 50, "Press any key to exit:");
- getch(); /* Wait until a key is pressed */
- closegraph(); /* Exit graphics library */
- }